package com.zsqx.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Sort;

/**
 * Student entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "student", schema = "dbo", catalog = "test")
public class Student implements java.io.Serializable {

	// Fields

	private Integer id;
	private String name;
	private String pwd;
	private School school;
	private Date createtime;
	private Date modifytime;
	private Set<TStudentCourse> studentCousrses = new HashSet<TStudentCourse>(0);

	// Constructors

	/** default constructor */
	public Student() {
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "name", length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "pwd", length = 50)
	public String getPwd() {
		return this.pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
	
	@ManyToOne(fetch=FetchType.EAGER)
    @JoinColumn(name="school_id")
	public School getSchool() {
		return school;
	}

	public void setSchool(School school) {
		this.school = school;
	}
	
	@Column(name = "createtime", length = 23)
	public Date getCreatetime() {
		return this.createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	@Column(name = "modifytime", length = 23)
	public Date getModifytime() {
		return this.modifytime;
	}

	public void setModifytime(Date modifytime) {
		this.modifytime = modifytime;
	}

	
	@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="studentId")
	public Set<TStudentCourse> getStudentCousrses() {
		return studentCousrses;
	}

	public void setStudentCousrses(Set<TStudentCourse> studentCousrses) {
		this.studentCousrses = studentCousrses;
	}

	
}